package jsj.mynet;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class InetAddressDemo {

	public static void main(String[] args) throws UnknownHostException {
		InetAddress ip = InetAddress.getByName("www.baidu.com");
		System.out.println(ip.getHostAddress());
		System.out.println(ip.getHostName());
		InetAddress ip2 = InetAddress.getLocalHost();
		System.out.println(ip2.getHostAddress());
		System.out.println(ip2.getHostName());

	}

}
